package com.jdk.learn.juc2.thread.excrise;

import java.util.concurrent.CountDownLatch;

/**
 * 类功能描述:
 *      等待线程A和B处理完业务
 * @author bgt
 * @version V1.0
 * @since 2019-02-21 13:39
 */
public class PrintABByCountDownDemo {
    private static volatile CountDownLatch countDownLatch=new CountDownLatch(2);
    public static void main(String[] args) throws InterruptedException {
        Thread printA=new Thread(()->{
                //这个是测试
                System.out.println("A");
                countDownLatch.countDown();
        });
        Thread printB=new Thread(()->{
                System.out.println("B");
                countDownLatch.countDown();
        });
        printA.start();
        printB.start();
        countDownLatch.await();
    }
}
